package com.jlpay.openapi.demo.openmerch.alipay;

import com.jlpay.open.jlpay.sdk.java.model.openmerch.alipay.request.RealnameAliQueryRequest;
import com.jlpay.open.jlpay.sdk.java.model.openmerch.alipay.response.RealnameAliQueryResponse;
import com.jlpay.open.jlpay.sdk.java.utils.json.JsonUtils;
import com.jlpay.openapi.demo.JlpayOpenApiService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author chenjunhong
 * @since 2024/3/25
 */
public class AlipayRealnameQueryService {

    private static final Logger LOGGER = LoggerFactory.getLogger(AlipayRealnameQueryService.class);

    public static void main(String[] args) {
        RealnameAliQueryRequest realnameAliQueryRequest = buildRealnameAliQueryRequest();
        RealnameAliQueryResponse realnameAliQueryResponse = JlpayOpenApiService.openMerchService()
                .post(realnameAliQueryRequest, RealnameAliQueryResponse.class);
        LOGGER.info("支付宝实名认证查询响应:{}", JsonUtils.toString(realnameAliQueryResponse));
    }

    private static RealnameAliQueryRequest buildRealnameAliQueryRequest() {
        RealnameAliQueryRequest realnameAliQueryRequest = new RealnameAliQueryRequest();
        // 商户号
        realnameAliQueryRequest.setMerchNo("849584358140020");
        // 查询类型，0-申请单查询（默认），1-授权结果查询
        realnameAliQueryRequest.setQueryType("0");
        return realnameAliQueryRequest;
    }

}
